package com.text.day1_4;

import java.util.Scanner;

public class HomeWork {
    public static void huiWen(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入一个不大于8位的数字");
        int a = scanner.nextInt();
        String ac = a + "";
        char[] abc = ac.toCharArray();
//        System.out.println(abc);
        boolean flag = true;
        for (int i = 0; i < abc.length / 2; i++) {
            if (abc[i] != abc[abc.length - i - 1])
                flag = false;
        }
        System.out.println(flag? "是回文":"不是回文");
    }

    public static void yueSe(){
        int[] ren = new int[8];
        for (int i = 0; i < ren.length; i++) {
            ren[i] = i;
        }
        qiangBi(ren);

    }
    public static void qiangBi(int[] a){
        System.out.println(a[2 % a.length] + "枪毙");
        huoDe(a,2 % a.length);
    }
    public static void huoDe(int[] a,int si){
        int[] b = new int[a.length - 1];
        System.arraycopy(a,si + 1,b,0,b.length - si);
        System.arraycopy(a,0,b,b.length - si,si);
//        for (int i = 0; i < a.length; i++) {
//            System.out.print(a[i] + " ");
//        }
//        System.out.println();
//        for (int i = 0; i < b.length; i++) {
//            System.out.print(b[i] + " ");
//        }
        if (b.length == 1)
            System.out.println("活的" + b[0]);
        else
            qiangBi(b);
    }
    public static void main(String[] args) {
        huiWen();
        System.out.println();
        yueSe();


        int[] a = new int[5];
        for (int i : a) {
            //增强for循环      和  for  in  类似   i是数组里的值，不是下标
        }
    }
}
